Reseller Domain Murah dan termurah di Indonesia? ya di ResellerCamp.
         
 

Forum PHP Indonesia

 
Advanced Search
   
 
Home Register FAQ Memberlist Usergroups  
 
 

Forum PHP Indonesia Forum Index HTML + Javascript [TOLONG] segala cara agr page g bs dRefresh,tp ttp bs submit
Display posts from previous:   
      All times are GMT + 7 Hours  

[TOLONG] segala cara agr page g bs dRefresh,tp ttp bs submit

Post new topic  Reply to topic Goto page 1, 2  Next

Fri Jan 01, 2010 17:40
Author Message
hous3b4d
PHP Master
PHP Master


Joined: 08 Sep 2009
Posts: 192
Location: gamping, sleman, yogyakarta

Post subject: [TOLONG] segala cara agr page g bs dRefresh,tp ttp bs submit Reply with quote

help...

Q ada hlm dg timer,kl waktuN udah abs lgsung proses kHlm lain,,
tp mslhN kl wktuN udah abs trs proses kPage lain,,isian formN g kBaca sma sX...(implementasi dHlm utk ulangan OL)...kl hlm dRefresh,waktu kmbli ke set awal,jd kl dRefreh mulu,g sleseČ...

---tolong donk,script biar hlm g bs dRefresh...---

ato

---kl wktu udah abs,hlm pindah kHlm briutnya efekN sama kl Qt manual submit mski ada soal yg blum dJawab...---

makasih smua....
Salute! Salute! Salute! Helppp!! Helppp!! Salute! Salute! Salute!

====================================================
ngejar deadline...
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Sun Jan 03, 2010 00:04
Author Message
feryardiant
Anak Baru
Anak Baru


Joined: 12 Dec 2009
Posts: 4
Location: Pekalongan, Indonesia

Post subject: Reply with quote

waduh...
ternyata kita punya masalha yang sama....

pak admin... or prend" yang dah pada expert d forum ne...
bantuin dunk......

Big Smile Salute! Salute! Salute! Salute! Helppp!! Helppp!! Confuse Confuse Confuse
 
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
      Back To Top  

Tue Jan 05, 2010 10:05
Author Message
desrizal
Jagoan PHP
Jagoan PHP


Joined: 21 May 2009
Posts: 448
Location: Papua

Post subject: Reply with quote

---Kalau pengen timernya ketika browser direfresh nggak balek ke nol lagi..simpan nilainya ke dalam cookies.

---untuk submit form lewat javascript gunakan fungsi submit()

berikut contohnya
======================================================
<html>
<head>
<script type="text/javascript">
var waktu = 1;
var batas = 50;//dalam detik ubah sesuai keinginan, setelah 50 detik akan submit form
var selesai = 0;

function init(){
checkCookie();
mulai();
}

function mulai(){
m = Math.floor(waktu/60);
d = waktu%60;
if(m<10){
menit = "0"+m;
}else{
menit = m;
}
if(d<10){
detik = "0"+d;
}else{
detik = d;
}
document.getElementById("divwaktu").innerHTML = "Time = "+menit+":"+detik;
if(waktu <= batas){
setCookie('waktux',waktu,1)
t = setTimeout("mulai()",1000);
}else{
if(t){
clearTimeout(t);
}
selesai = 1;
setCookie('waktux',"",-1);
document.getElementById("formulir").submit();
}
waktu++;
}

function getCookie(c_name){
if (document.cookie.length>0){
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1){
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return "";
}

function setCookie(c_name,value,expiredays){
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function checkCookie(){
waktux=getCookie('waktux');
if (waktux!=null && waktux!=""){
waktu = waktux;
}else{
waktu = waktu;
}
}
</script>
</head>
<body onload="init()">
<div id=divwaktu></div>

<form action=inputnilai.php method=post id=formulir>
Soal nya ada di sini... <p>
<input type=submit>
</form>

</body>
</html>
==============================================
_________________
http://blog.codingwear.com
===================
PHP Ajax jQuery Tutorial
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Tue Jan 05, 2010 12:25
Author Message
hous3b4d
PHP Master
PHP Master


Joined: 08 Sep 2009
Posts: 192
Location: gamping, sleman, yogyakarta

Post subject: Reply with quote

wah 100% mantap nih script...

maksih bgt kk....
Q coba dlu ah...
ntr kl ada yg bingung,t'tanya lg,soalN Q udah bkin timer countdown jam:menit:detik,mw Q masukkin kScriptN dr kk...

kl error Q mw tanya lagi...

nih countdown gak jelas buatanQ...
Code:
<?php <head>
<?
php
$q_jam
=mysql_query("select * from ulg_waktu where kelas='$kelas' and id_mapel='$id_mapel' and ulangan_ke='$ulangan_ke'");
$isi_jam=mysql_fetch_array($q_jam);
$jam=$isi_jam['jam'];
$menit=$isi_jam['menit'];

?>
<script language="jscript" type="text/javascript">
<?php
echo 'var jam = '.$jam.';';
echo 
'var menit = '.$menit.';';
echo 
'var detik = 1;';
?>
function startClock() {
 if (detik !== 0) {
  detik = detik-1;
  document.frm.clock.value = jam+":"+menit+":"+detik;
  setTimeout("startClock()", 1000);
 }
 if (detik == 0) {
  detik = 60;
  menit = menit-1;
  document.frm.clock.value = jam+":"+menit+":"+detik;
 }
 if(menit == 0 || menit == -1) {
  if(jam == 0 && menit == -1){
   document.frm.clock.value = "0:0:0";
   window.location='index.php?a=hasil_ulanganku';
  }
  else if(jam !== 0){
   menit = 59;
   jam = jam-1;
   document.frm.clock.value = jam+":"+menit+":"+detik;
  }
  else if(jam == 0){
   menit = 0;
   jam = 0;
   document.frm.clock.value =  jam+":"+menit+":"+detik;
  }
 }
}

</script>
</head>

<body onLoad="startClock()">        
<form name="frm">
<div><input name="clock" size="10" style="border:none;font-weight:bold;font-size: 14px;color:black;background-color:transparent;" type="text"></div>
</form>
</body> ?>
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Tue Jan 05, 2010 18:53
Author Message
hous3b4d
PHP Master
PHP Master


Joined: 08 Sep 2009
Posts: 192
Location: gamping, sleman, yogyakarta

Post subject: Reply with quote

master DRZ,,udah bs..Q ksih tmbahan bwt nampilin jamnya..jd lbih ringkes scriptnya drdp punya Q...

Code:
<?php <html>
<
head>
<
script type="text/javascript">
var 
waktu 7200;
var 
batas 1;//dalam detik ubah sesuai keinginan, setelah 50 detik akan submit form
var selesai 0;

function 
init(){
checkCookie();
mulai();
}

function 
mulai(){
Math.floor(waktu/3600);
Math.floor((waktu-(j*3600))/60);
//m = Math.floor(waktu/60);
waktu%60;
 if(
j<10){
 
jam "0"+j;
 }
 else{
 
jam j;
 }

 if(
m<10){
 
menit "0"+m;
 }
 else{
 
menit m;
 }

 if(
d<10){
 
detik "0"+d;
 }else{
 
detik d;
 }
document.getElementById("divwaktu").innerHTML "Time = "+j+":"+menit+":"+detik;
 
 if(
batas <= waktu){
 
setCookie('waktux',waktu,1)
 
setTimeout("mulai()",1);
 }
 else{
  if(
t){
  
clearTimeout(t);
  }
 
selesai 1;
 
setCookie('waktux',"",-1);
 
document.getElementById("formulir").submit();
 }
waktu--;
}

<!--
cookie-->
function 
getCookie(c_name){
if (
document.cookie.length>0){
c_start=document.cookie.indexOf(c_name "=");
 if (
c_start!=-1){
 
c_start=c_start c_name.length+1;
 
c_end=document.cookie.indexOf(";",c_start);
  if (
c_end==-1c_end=document.cookie.length;
  return 
unescape(document.cookie.substring(c_start,c_end));
  }
 }
return 
"";
}

function 
setCookie(c_name,value,expiredays){
var 
exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name"=" +escape(value)+
((
expiredays==null) ? "" ";expires="+exdate.toGMTString());
}

function 
checkCookie(){
 
waktux=getCookie('waktux');
 if (
waktux!=null && waktux!=""){
 
waktu waktux;
 }else{
 
waktu waktu;
 }
}
</script>
</head>
<body onLoad="init()">
<div id=divwaktu></div>

<form action=inputnilai.php method=post id=formulir>
<p>Soal nya ada di sini... </p>
<input type=submit>
</form>

</body>
</html> ?>


maksih banget master
hail hail hail hail
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Sun Jul 11, 2010 12:07
Author Message
pephy
PHP Programmer
PHP Programmer


Joined: 11 Jun 2010
Posts: 59
Location: indonesia

Post subject: Reply with quote

mw tnya jg nih ..

ak pnya script ini ...
gmn gabungin script countdown di atas agar bisa menangkap nilai dari file ini untuk saya redirect ke file selanjutnya ...

Code:
<?php <?php session_start(); 

require_once(
"connects.php");  

$jml 5

if(
$_POST['user']=="jawab"

    
$forredirect true
    for(
$i=1$i<=$jml$i++) 
    { 
        
$ns $_POST["s_".$i.""]; 
        
$jb $_POST["j_".$i.""]; 
        
$jwb mysql_query("select * from mudah where id_soal_mudah='".$ns."' and jbnar_mudah='".$jb."'");
        if(
mysql_num_rows($jwb)==0)  
        { 
            
$nilai[$i] = 0
            if(
$jb
                if (!
$forredirect) echo 'Jawaban Soal No. '.$i.' - '.$jb.' : <FONT COLOR="red">SALAH</FONT><BR>'
            else 
                if (!
$forredirect) echo 'Tidak menjawab soal nomor '.$i.'<br>'
        } 
        else 
        { 
            
$nilai[$i] = 1
            if(
$jb
                if (!
$forredirect) echo 'Jawaban Soal No. '.$i.' - '.$jb.' : BENAR<BR>'
         
        
// Tempat masukkan jawaban dalam database 
                 
        // Tempat masukkan jawaban dalam database end 
        

         
    } 
    
// REKAP NILAI 
    
$nbenar array_sum($nilai); 
    
$nsalah $jml-$nbenar
    
$ntotal number_format($nbenar/$jml*100,1); 
    
$_SESSION["mudah"]["nbenar"] = $nbenar
    
$_SESSION["mudah"]["nsalah"] = $nsalah
    
$_SESSION["mudah"]["ntotal"] = $nbenar/$jml*100
    if (
$forredirect
    { 
      
header('location: sedang.php'); 
      die(
''); 
    } 
    echo 
'<br \><A HREF="sedang.php">Lanjut</A><br \>'

else 

echo 
'<FORM METHOD="POST" ACTION=""> 
<INPUT TYPE="hidden" NAME="user" value="jawab">'

echo 
'<B>Soal Ujian Ketegori Mudah dengan Jumlah SOAL '.$jml.'</B>'
echo(
'<br />');
echo 
'<OL>'
$sx mysql_query("SELECT * FROM mudah ORDER BY RAND() LIMIT $jml"); 
$no 1
while(
$x=mysql_fetch_array($sx)) 

    echo 
'<INPUT TYPE="hidden" NAME="s_'.$no.'" value="'.$x[id_soal_mudah].'">'
    echo 
'<LI>'.$x[soal_mudah].'<br>'
    
// pilihan  
    
echo ' <INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j1_mudah].'">A. '$x[j1_mudah].' '; echo('<br />');
    echo 
' <INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j2_mudah].'">B. '$x[j2_mudah].' '; echo('<br />');
    echo 
' <INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j3_mudah].'">C. '$x[j3_mudah].' '; echo('<br />');
    echo 
' <INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j4_mudah].'">D. '$x[j4_mudah].' '; echo('<br />');
    echo
'</LI>'
    
$no++; 

echo 
'</OL>'
echo 
'<INPUT TYPE="submit" value="Lanjut"> 
</FORM>'

?> ?>



mohon bantuannya ..

terima kasih ...
_________________
Berbagi iL mu itu Indah ....
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Mon Jul 12, 2010 00:01
Author Message
hous3b4d
PHP Master
PHP Master


Joined: 08 Sep 2009
Posts: 192
Location: gamping, sleman, yogyakarta

Post subject: Reply with quote

script countdownnya taro di atas, dalam tag <head> ... </head> dan di luar <?php ... ?>
id yg ada di document.getElementById("formulir").submit(); disesuain ama nama id formnya...

trs tag formnya juga (<form> ... </form>) jgn masukin dalam PHP... ntr formya kasih ky dibawah ini, value file target ganti sndiri
<form method="post" id="formulir" name="ulangan" action="alamat_file_hasil"> ... </form>
_________________
anak SMK?? BISA...!! Alhamdulillah lulus 2009/2010 nih...
btw, scriptnya bner gak y...?
dicoba dlu, yg penting basmalah dlu deh...
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Wed Jul 14, 2010 10:57
Author Message
pephy
PHP Programmer
PHP Programmer


Joined: 11 Jun 2010
Posts: 59
Location: indonesia

Post subject: Reply with quote

sudah saya coba ...
msh tdk bisa ...
punya solusi lagi tdk ???


mhon bntuannya ...
trims...
_________________
Berbagi iL mu itu Indah ....
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Fri Jul 16, 2010 06:57
Author Message
hous3b4d
PHP Master
PHP Master


Joined: 08 Sep 2009
Posts: 192
Location: gamping, sleman, yogyakarta

Post subject: Reply with quote

liat scriptnya...
_________________
anak SMK?? BISA...!! Alhamdulillah lulus 2009/2010 nih...
btw, scriptnya bner gak y...?
dicoba dlu, yg penting basmalah dlu deh...
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Fri Jul 16, 2010 10:48
Author Message
pephy
PHP Programmer
PHP Programmer


Joined: 11 Jun 2010
Posts: 59
Location: indonesia

Post subject: Reply with quote

ini kk scriptnya :

Code:
<?php <?php session_start(); 
require_once(
"connects.php");  
?>
<html>
<head>

Waktu ujian 30 menit

<script type="text/javascript">
var waktu = 0;
var batas = 1800;//dalam detik ubah sesuai keinginan, setelah 50 detik akan submit form
var selesai = 0;

function init(){
checkCookie();
mulai();
}

function mulai(){
m = Math.floor(waktu/60);
d = waktu%60;
if(m<10){
menit = "0"+m;
}else{
menit = m;
}
if(d<10){
detik = "0"+d;
}else{
detik = d;
}
document.getElementById("divwaktu").innerHTML = "Time = "+menit+":"+detik;
if(waktu <= batas){
setCookie('waktux',waktu,1)
t = setTimeout("mulai()",1000);
}else{
if(t){
clearTimeout(t);
}
selesai = 1;
setCookie('waktux',"",-1);
document.getElementById("user").submit();
}
waktu++;
}

function getCookie(c_name){
if (document.cookie.length>0){
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1){
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return "";
}

function setCookie(c_name,value,expiredays){
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function checkCookie(){
waktux=getCookie('waktux');
if (waktux!=null && waktux!=""){
waktu = waktux;
}else{
waktu = waktu;
}
}
</script>
</head>
<body onLoad="init()">
<div id=divwaktu></div>


<?php
$jml 
5

if(
$_POST['user']=="jawab"

    
$forredirect true
    for(
$i=1$i<=$jml$i++) 
    { 
        
$ns $_POST["s_".$i.""]; 
        
$jb $_POST["j_".$i.""]; 
        
$jwb mysql_query("select * from mudah where id_soal_mudah='".$ns."' and jbnar_mudah='".$jb."'");
        if(
mysql_num_rows($jwb)==0)  
        { 
            
$nilai[$i] = 0
            if(
$jb
                if (!
$forredirect) echo 'Jawaban Soal No. '.$i.' - '.$jb.' : <FONT COLOR="red">SALAH</FONT><BR>'
            else 
                if (!
$forredirect) echo 'Tidak menjawab soal nomor '.$i.'<br>'
        } 
        else 
        { 
            
$nilai[$i] = 1
            if(
$jb
                if (!
$forredirect) echo 'Jawaban Soal No. '.$i.' - '.$jb.' : BENAR<BR>'
         
        
// Tempat masukkan jawaban dalam database 
                 
        // Tempat masukkan jawaban dalam database end 
        

         
    } 
    
// REKAP NILAI 
    
$nbenar array_sum($nilai); 
    
$nsalah $jml-$nbenar
    
$ntotal number_format($nbenar/$jml*100,1);
    
$persen 20 100 
    
$_SESSION["mudah"]["nbenar"] = $nbenar
    
$_SESSION["mudah"]["nsalah"] = $nsalah
    
$_SESSION["mudah"]["ntotal"] = $nbenar/$jml*100
    
$_SESSION["mudah"]["persen"] = $persen;
    
    if(
$nbenar==0)
    {
    if(
$ntotal==0)
    
$g '<U><b><font color="red">GAGAL</font></B></U>';
    
$_SESSION["mudah"]["kategori"] = $g;
    }
    
    if(
$nbenar>0)
    {
    if(
$ntotal>=90)
                
$k '<b><U><i>LULUS</i></u></b>';
            elseif(
$ntotal>=70 && $ntotal<90)
                
$k '<b><u><i>LULUS</i></u></b>';
            elseif(
$ntotal>=60 && $ntotal<70)
                
$k '<b><u><i>LULUS</i></u></b>';
            elseif(
$ntotal>=50 && $ntotal<60)
                
$k '<FONT COLOR="red"><b><U><i>GAGAL</i></u></b></FONT>';
            else
                
$k '<FONT COLOR="red"><b><u><i>GAGAL</i></u></b></FONT>';    
    
$_SESSION["mudah"]["kategori"] = $k;    
    }
                
    if (
$forredirect
    { 
      
header('location: sedang.php'); 
      die(
'');
      
    } 
    
    echo 
'<br \><A HREF="sedang.php">Lanjut</A><br \>'

else 

echo 
'<FORM METHOD="POST" ACTION=""> 
<INPUT TYPE="hidden" NAME="user" value="jawab">'

echo 
'<B>Soal Ujian Ketegori Mudah dengan Jumlah SOAL '.$jml.'</B>'
echo(
'<br />');
echo 
'<OL>'
$sx mysql_query("SELECT * FROM mudah ORDER BY RAND() LIMIT $jml"); 
$no 1
while(
$x=mysql_fetch_array($sx)) 

    echo 
'<INPUT TYPE="hidden" NAME="s_'.$no.'" value="'.$x[id_soal_mudah].'">'
    echo 
'<LI>'.$x[soal_mudah].'<br>'
    
// pilihan  
    
echo ' <INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j1_mudah].'">A. '$x[j1_mudah].' '; echo('<br />');
    echo 
' <INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j2_mudah].'">B. '$x[j2_mudah].' '; echo('<br />');
    echo 
' <INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j3_mudah].'">C. '$x[j3_mudah].' '; echo('<br />');
    echo 
' <INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j4_mudah].'">D. '$x[j4_mudah].' '; echo('<br />');
    echo
'</LI>'
    
$no++; 

echo 
'</OL>'
echo 
'<INPUT TYPE="submit" value="Lanjut"> 
</FORM>'

?>

<form action=sedang.php method=post id=user>
</form>

</body>
</html> ?>



sudah bisa redirect tp nilai di file itw tdk bisa diambil bila countdownya uda abs ..
yg perlu dgnti apa yaa??????
tlng donk...

thx a lot yaa ..
_________________
Berbagi iL mu itu Indah ....
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Tue Jul 20, 2010 15:51
Author Message
hous3b4d
PHP Master
PHP Master


Joined: 08 Sep 2009
Posts: 192
Location: gamping, sleman, yogyakarta

Post subject: Reply with quote

maaf lama yg bales...

maksudQ tuh tag <form> ttp ada satu, tp ada di luar script PHP, kan bisa taro di tengah-tengah tapi di luar PHP,
misal
<?php
// script ambil soal
?>
<form id="formulir" method="post" action="file_tujuan.php">
<?php
//isi soalnya
?>
<input type="submit" value="jawab">
</form>

trs di tag form ada id="formulir" itu harus sama dengan di script JSnya document.getElementById("formulir").submit();

==
nih coba script kamu dibagi jadi 2 file y kk??
1. soal.php
Code:
<?php <?php session_start(); 
require_once(
"connects.php");  
?>
<html>
<head>

<script type="text/javascript">
//Waktu ujian 30 menit
var waktu = 0;
var batas = 1800;//dalam detik ubah sesuai keinginan, setelah 50 detik akan submit form
var selesai = 0;

function init(){
checkCookie();
mulai();
}

function mulai(){
m = Math.floor(waktu/60);
d = waktu%60;
if(m<10){
menit = "0"+m;
}else{
menit = m;
}
if(d<10){
detik = "0"+d;
}else{
detik = d;
}
document.getElementById("divwaktu").innerHTML = "Time = "+menit+":"+detik;
if(waktu <= batas){
setCookie('waktux',waktu,1)
t = setTimeout("mulai()",1000);
}else{
if(t){
clearTimeout(t);
}
selesai = 1;
setCookie('waktux',"",-1);
document.getElementById("formulir").submit();
}
waktu++;
}

function getCookie(c_name){
if (document.cookie.length>0){
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1){
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return "";
}

function setCookie(c_name,value,expiredays){
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function checkCookie(){
waktux=getCookie('waktux');
if (waktux!=null && waktux!=""){
waktu = waktux;
}else{
waktu = waktu;
}
}
</script>
</head>
<body onLoad="init()">
<div id=divwaktu></div>

<FORM method="POST" action="HASIL.PHP" ID="formulir"> 
<INPUT TYPE="hidden" NAME="user" value="jawab">
<?php
$jml 
5;  
echo 
'<B>Soal Ujian Ketegori Mudah dengan Jumlah SOAL '.$jml.'</B>'
echo(
'<br />');
echo 
'<OL>'
$sx mysql_query("SELECT * FROM mudah ORDER BY RAND() LIMIT $jml"); 
$no 1
while(
$x=mysql_fetch_array($sx)) 

    echo 
'<INPUT TYPE="hidden" NAME="s_'.$no.'" value="'.$x[id_soal_mudah].'">'
    echo 
'<LI>'.$x[soal_mudah].'<br>'
    
// pilihan  
    
echo ' <INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j1_mudah].'">A. '$x[j1_mudah].' '; echo('<br />');
    echo 
' <INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j2_mudah].'">B. '$x[j2_mudah].' '; echo('<br />');
    echo 
' <INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j3_mudah].'">C. '$x[j3_mudah].' '; echo('<br />');
    echo 
' <INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j4_mudah].'">D. '$x[j4_mudah].' '; echo('<br />');
    echo
'</LI>'
    
$no++; 

echo 
'</OL>';
?>
<INPUT TYPE="submit" value="Lanjut"> 
</FORM>

</body>
</html> ?>


2. hasil.php
Code:
<?php <?php
 
    $forredirect 
true
    for(
$i=1$i<=$jml$i++) 
    { 
        
$ns $_POST["s_".$i.""]; 
        
$jb $_POST["j_".$i.""]; 
        
$jwb mysql_query("select * from mudah where id_soal_mudah='".$ns."' and jbnar_mudah='".$jb."'");
        if(
mysql_num_rows($jwb)==0)  
        { 
            
$nilai[$i] = 0
            if(
$jb
                if (!
$forredirect) echo 'Jawaban Soal No. '.$i.' - '.$jb.' : <FONT COLOR="red">SALAH</FONT><BR>'
            else 
                if (!
$forredirect) echo 'Tidak menjawab soal nomor '.$i.'<br>'
        } 
        else 
        { 
            
$nilai[$i] = 1
            if(
$jb
                if (!
$forredirect) echo 'Jawaban Soal No. '.$i.' - '.$jb.' : BENAR<BR>'
         
        
// Tempat masukkan jawaban dalam database 
                 
        // Tempat masukkan jawaban dalam database end 
        

         
    } 
    
// REKAP NILAI 
    
$nbenar array_sum($nilai); 
    
$nsalah $jml-$nbenar
    
$ntotal number_format($nbenar/$jml*100,1);
    
$persen 20 100 
    
$_SESSION["mudah"]["nbenar"] = $nbenar
    
$_SESSION["mudah"]["nsalah"] = $nsalah
    
$_SESSION["mudah"]["ntotal"] = $nbenar/$jml*100
    
$_SESSION["mudah"]["persen"] = $persen;
    
    if(
$nbenar==0)
    {
    if(
$ntotal==0)
    
$g '<U><b><font color="red">GAGAL</font></B></U>';
    
$_SESSION["mudah"]["kategori"] = $g;
    }
    
    if(
$nbenar>0)
    {
    if(
$ntotal>=90)
                
$k '<b><U><i>LULUS</i></u></b>';
            elseif(
$ntotal>=70 && $ntotal<90)
                
$k '<b><u><i>LULUS</i></u></b>';
            elseif(
$ntotal>=60 && $ntotal<70)
                
$k '<b><u><i>LULUS</i></u></b>';
            elseif(
$ntotal>=50 && $ntotal<60)
                
$k '<FONT COLOR="red"><b><U><i>GAGAL</i></u></b></FONT>';
            else
                
$k '<FONT COLOR="red"><b><u><i>GAGAL</i></u></b></FONT>';    
    
$_SESSION["mudah"]["kategori"] = $k;    
    }
                
    if (
$forredirect
    { 
      
header('location: sedang.php'); 
      die(
'');
      
    } 
    
    echo 
'<br \><A HREF="sedang.php">Lanjut</A><br \>';
?> ?>


bs ga y?? itu blum kucoba...

klo script ujianku yg diajarin ky gni http://www.forumphp.web.id/viewtopic.php?t=5230&highlight=ujian tp blum gabung ama count downnya..
_________________
anak SMK?? BISA...!! Alhamdulillah lulus 2009/2010 nih...
btw, scriptnya bner gak y...?
dicoba dlu, yg penting basmalah dlu deh...
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Fri Jul 30, 2010 03:44
Author Message
pephy
PHP Programmer
PHP Programmer


Joined: 11 Jun 2010
Posts: 59
Location: indonesia

Post subject: Reply with quote

bgni kk . ak punya 4 file php .
mudah.php, sedang.php, sulit.php dan hasil.php .
nah dari file mudah.php redirect ke sedang.php tz redirect ke sulit.php dan terakhir redirect ke hasil.php .
nah gmn biar waktu countdownya itw bsa bwa nilai ujian yg telah dkerjakan dari mudah,sedang,sulit ke hasil.php .
jika msalkan waktu countdownya atw timernya habis ...

tlng bantuin yaa..
terima kasih banyak ..
_________________
Berbagi iL mu itu Indah ....
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Mon Aug 02, 2010 02:04
Author Message
hous3b4d
PHP Master
PHP Master


Joined: 08 Sep 2009
Posts: 192
Location: gamping, sleman, yogyakarta

Post subject: Reply with quote

urutannya pasti sllu mudah->sedang->sulit-> hasil...??

y bkin aja hidden text
<input type="hidden" name="nilai" id="nilai" value="'.$nilai.'">
di bagian akhir <form>.. bArti harus ada perhitungannya sperti pada file hasil.php di stiap awal sedang.php dan sulit.php... trs tampilin hasilnya di hasil.php...
_________________
anak SMK?? BISA...!! Alhamdulillah lulus 2009/2010 nih...
btw, scriptnya bner gak y...?
dicoba dlu, yg penting basmalah dlu deh...
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Mon Aug 02, 2010 08:10
Author Message
pephy
PHP Programmer
PHP Programmer


Joined: 11 Jun 2010
Posts: 59
Location: indonesia

Post subject: Reply with quote

yups. urutannya bgtu kk .
maaf aku msh bngung kk .
kn tiap file pke timer . jd di mudah.php ak timer 30 mnit tz di sedang.php ak timer 60 menit tz di sulit.php ak timer 90 menit dan trakhir di file hasil.php menampilkan hasil nilai total. bgtu mksd ak kk.
kl yg kk cntohkn di atas brarti ak haruz bwd file2 php lebih dari 4 file donk???

tlng bntuannya. trims
_________________
Berbagi iL mu itu Indah ....
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Tue Aug 03, 2010 01:24
Author Message
hous3b4d
PHP Master
PHP Master


Joined: 08 Sep 2009
Posts: 192
Location: gamping, sleman, yogyakarta

Post subject: Reply with quote

hmm... kynya butuh 2 aja...

soal.php dan hasil.php

ntr untuk masuk ke soal.php pke link
misal, index.php?soal=mudah

di file index.php
ada

Code:
<?php $a=$_GET[soal];
if(
$a=="mudah") include ('soal.php');
elseif(
$a=="sedang") include ('soal.php');
elseif(
$a=="sulit") include ('soal.php');
elseif(
$a=="hasil") include ('hasil.php'); ?>


trs disoal.php ada

Code:
<?php <?php
//....
$tingkat=$_GET[soal];

if(
$tingkat=="mudah"){
// $next="sedang";
// query soal mudah, pengambilan dari tabel, set waktu
}
elseif(
$tingkat=="sedang"){
// $next="sulit";
// query soal mudah, pengambilan dari tabel, set waktu
// mungkin bisa dikasih juga bobot nilainya untuk soal mudah
}
elseif(
$tingkat=="sulit"){
// $next="hasil";
// query soal mudah, pengambilan dari tabel, set waktu
// mungkin bisa dikasih juga bobot nilainya untuk soal sedang
}

//script perhitungan nilainya trus taro valuenya di hidden textfield di bawah

<form method="post" action="index.php?soal='.$next.'">
//tampilin soal
<input type="hidden" name="nilai" id="nilai" /> //ada hidden texfield buat nyimpen total nilai dari sulit-mudah, yang sulit sekalian ditambahin di hasil.php
</form>
//......
?> ?>


trus di hasil.php

mungkin tinggal ambil
Code:
<?php $nilai=$_POST['nilai']; //value dari soal.php tahap terakhir aja

//perhitungan nilai
// sama menampilkan total nilainya 
?>


bgitu mungkin... tp saya blum nyoba, blum ada waktu...
_________________
anak SMK?? BISA...!! Alhamdulillah lulus 2009/2010 nih...
btw, scriptnya bner gak y...?
dicoba dlu, yg penting basmalah dlu deh...
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  
Post new topic  Reply to topic Goto page 1, 2  Next

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


      Back To Top  

Page 1 of 2
Goto page 1, 2  Next
Jump to:  
Powered by phpBB © 2001, 2002 phpBB Group
Toko Kaos Couple | Avalanche style by What Is Real © 2004 | Toko Baju Butik Online | Cara Pedia | Busana Baju Muslim